#include "configfile.h"
    
	ConfigFile::ConfigFile(QString filename) : QFile(filename)
	{

    	this->open(QIODevice::ReadOnly | QIODevice::Text);
    	// Datei wird zeilenweise ausgelesen
    	while (!this->atEnd()) {
            QByteArray line = this->readLine();
            prepareLine(QString(line));
        }
        this->close();
	}
		
    QString ConfigFile::getValue(QString key)
	{
       return hash[key];
 
    }
    void ConfigFile::prepareLine(QString line){
       int index=line.indexOf("#");
       line=line.mid(0,index);
       line=line.trimmed();
       if(line!=""){
       	 QStringList pair=line.split("=");
       	 hash[pair[0].trimmed()]=pair[1].trimmed();
       }
       
    }
    
